const express = require('express');
const cors = require('cors');
const path = require('path');

const app = express();
const PORT = process.env.PORT || 3000;

// 中间件
app.use(cors());
app.use(express.json());
app.use(express.static(path.join(__dirname, 'public')));

// API路由
app.get('/api/ping', (req, res) => {
    res.json({ msg: 'pong' });
});

// 健康检查
app.get('/api/health', (req, res) => {
    res.json({ status: 'ok', timestamp: new Date().toISOString() });
});

// 启动服务器
app.listen(PORT, () => {
    console.log(`🚀 A_A 服务器运行在 http://localhost:${PORT}`);
    console.log(`📁 静态文件目录: ${path.join(__dirname, 'public')}`);
});
